package com.yiyahui.project.erp.service.impl;

import java.util.List;
import com.yiyahui.common.utils.DateUtils;
import com.yiyahui.project.erp.domain.requestVo.YiyaAppointmentRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiyahui.project.erp.mapper.YiyaAppointmentMapper;
import com.yiyahui.project.erp.domain.YiyaAppointment;
import com.yiyahui.project.erp.service.IYiyaAppointmentService;

/**
 * 预约Service业务层处理
 * 
 * @author yiyahui
 * @date 2020-05-19
 */
@Service
public class YiyaAppointmentServiceImpl implements IYiyaAppointmentService 
{
    @Autowired
    private YiyaAppointmentMapper yiyaAppointmentMapper;

    /**
     * 查询预约
     * 
     * @param id 预约ID
     * @return 预约
     */
    @Override
    public YiyaAppointment selectYiyaAppointmentById(Long id)
    {
        return yiyaAppointmentMapper.selectYiyaAppointmentById(id);
    }

    /**
     * 查询预约列表
     * 
     * @param yiyaAppointmentRequest 预约
     * @return 预约
     */
    @Override
    public List<YiyaAppointment> selectYiyaAppointmentList(YiyaAppointmentRequest yiyaAppointmentRequest)
    {
        return yiyaAppointmentMapper.selectYiyaAppointmentList(yiyaAppointmentRequest);
    }

    /**
     * 新增预约
     * 
     * @param yiyaAppointment 预约
     * @return 结果
     */
    @Override
    public int insertYiyaAppointment(YiyaAppointment yiyaAppointment)
    {
        yiyaAppointment.setCreateTime(DateUtils.getNowDate());
        return yiyaAppointmentMapper.insertYiyaAppointment(yiyaAppointment);
    }

    /**
     * 修改预约
     * 
     * @param yiyaAppointment 预约
     * @return 结果
     */
    @Override
    public int updateYiyaAppointment(YiyaAppointment yiyaAppointment)
    {
        yiyaAppointment.setUpdateTime(DateUtils.getNowDate());
        return yiyaAppointmentMapper.updateYiyaAppointment(yiyaAppointment);
    }

    /**
     * 批量删除预约
     * 
     * @param ids 需要删除的预约ID
     * @return 结果
     */
    @Override
    public int deleteYiyaAppointmentByIds(Long[] ids)
    {
        return yiyaAppointmentMapper.deleteYiyaAppointmentByIds(ids);
    }

    /**
     * 删除预约信息
     * 
     * @param id 预约ID
     * @return 结果
     */
    @Override
    public int deleteYiyaAppointmentById(Long id)
    {
        return yiyaAppointmentMapper.deleteYiyaAppointmentById(id);
    }
}
